import base64

def decode(content):
    if type(content) == str:
        content = content.encode("utf-8")
    return base64.b64decode(content)

import re

def get_type(string):
    return re.findall(r"^\w+",string)[0]

with open("vmess.confidential.d/vmess.confidential","rb") as f:
    src = decode(f.read())
    src = src.decode("utf-8")
    src = src.split("\n")
    src = [x for x in src if len(x) > 1]
    lst = []
    for x in src:
        link_type = get_type(x)
        if link_type == "vmess":
            lst.append(x)
    with open("vmess.confidential.d/vmess_only.confidential","w+") as f0:
        f0.write("\n".join(lst))
#    print(set(types))
#trojan, vmess, ss ssr?
